# _*_ coding: utf-8 _*_
import pandas as pd
import numpy as np
import statsmodels.api as sm
from statsmodels.formula.api import ols #加载ols模型
from statsmodels.formula.api import poisson
import matplotlib.pyplot as plt

data = pd.read_csv("C:\\变量st.csv")
print(data.head())

y = data['工作日D']
x1 = data['X_NDVI']
x2 = data['X_街景绿化']
x3 = data['X_道路里程']
x4 = data['X_坡度']
x5 = data['X_公交站']
x6 = data['X_地铁站']
x7 = data['X_购物点']
x8 = data['X_混合']

x = np.column_stack((x1, x2, x3, x4, x5, x6, x7, x8))

# possion回归
model = sm.GLM(y,x,family=sm.families.Poisson())
# model=poisson(y,x)
results = model.fit()
print(results.summary())


